package com.ice.work.moment.user.dao.role;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.honeybee.cloud.framework.common.enums.DataStatusEnum;
import com.ice.work.moment.facade.user.model.Role;
import com.ice.work.moment.facade.user.param.PageRoleParam;
import com.ice.work.moment.facade.user.request.PageRoleRequest;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description role dao
 * @Author DELL
 * @Create 2019-01-10
 * @Since 1.0.0
 */
@Repository
public class RoleRepository extends ServiceImpl<IRoleMapper, Role>  implements IRoleRepository {


    @Override
    public Page<Role> page(IPage<Role> page, PageRoleParam param) {
        return this.baseMapper.page(page,param);
    }

    @Override
    public List<Role> findByType(Integer type) {
        return this.baseMapper.selectList(new QueryWrapper<Role>().lambda().eq(Role::getType, type).eq(Role::getDataStatus, DataStatusEnum.VALID.key));
    }
}


